/** NursePanel **/

package docoffice.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class NursePanel extends JPanel {
	
	private final JLabel nurseTitle, blank;
	
	private final JButton createPatient, editPatient, viewAppt, viewPatient;
	
	public NursePanel() {
		nurseTitle = new JLabel("Nurse Login");
		blank = new JLabel();
		createPatient = new JButton("Create New Patient");
		editPatient = new JButton("Edit a Patient");
		viewAppt = new JButton("View Appointments");
		viewPatient = new JButton("Patient Lookup");
		
		createPatient.addActionListener(new CreateListener());
		editPatient.addActionListener(new EditListener());
		viewAppt.addActionListener(new ViewApptListener());
		viewPatient.addActionListener(new ViewPatientListener());
		
		setLayout(new GridLayout(3, 2, 15, 10));
		add(nurseTitle);
		add(blank);
		add(createPatient);
		add(editPatient);
		add(viewAppt);
		
		setPreferredSize(new Dimension(500, 130));
		setBackground(Color.WHITE);
	}
	
	private class CreateListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			System.out.println("Create New Patient was clicked");
			removeAll();
			revalidate();
			repaint();
			add(new CreatePatient());
		}
	}
	
	private class EditListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			System.out.println("Delete a Patient was clicked");
			removeAll();
			revalidate();
			repaint();
			add(new EditPatient());
		}
	}
	
	private class ViewApptListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			System.out.println("View Appointments was clicked");
			removeAll();
			revalidate();
			repaint();
			add(new ViewAppt());
		}
	}
	
	private class ViewPatientListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			System.out.println("View Existing Patients was clicked");
		}
	}

	public String toString() {
		return "NursePanel [nurseTitle=" + nurseTitle + ", createPatient="
				+ createPatient + ", deletePatient=" + editPatient
				+ ", viewApp=" + viewAppt + ", viewPatient=" + viewPatient + "]";
	}

}
